import request from '@/utils/request'

// 获取基础数据
export function getFacilities() {
  return request({
    url: '/operation/api/monitor/facilities',
    method: 'get'
  })
}

export function getParams() {
  return request({
    url: '/operation/api/monitor/params',
    method: 'get'
  })
}

// 多参数对比分析
export function multiParamAnalysis(data) {
  return request({
    url: '/operation/api/monitor/multi-param-analysis',
    method: 'post',
    data
  })
}

// 单参数详细分析
export function singleParamAnalysis(data) {
  return request({
    url: '/operation/api/monitor/single-param-analysis',
    method: 'post',
    data
  })
}

// 用户视图管理
export function getUserViews(userId, pageType) {
  return request({
    url: '/operation/api/monitor/user-views',
    method: 'get',
    params: { userId, pageType }
  })
}

export function saveUserView(data) {
  return request({
    url: '/operation/api/monitor/save-view',
    method: 'post',
    data
  })
}

export function deleteUserView(viewId) {
  return request({
    url: `/operation/api/monitor/delete-view/${viewId}`,
    method: 'delete'
  })
}



// 历史数据查询
export function queryHistoryData(data) {
  return request({
    url: '/operation/api/history/query',
    method: 'post',
    data
  })
}

// 获取趋势数据
export function getTrendData(data) {
  return request({
    url: '/operation/api/history/trend',
    method: 'post',
    data
  })
}

// 获取设施树
export function getFacilityTree() {
  return request({
    url: '/operation/api/history/facility-tree',
    method: 'get'
  })
}

// 获取监测量分类
export function getTypeCategories() {
  return request({
    url: '/operation/api/history/type-categories',
    method: 'get'
  })
}

// 导出数据
export function exportHistoryData(data) {
  return request({
    url: '/operation/api/history/export',
    method: 'post',
    data
  })
}